package com.yoofn.framework.activity

import android.databinding.ViewDataBinding
import com.yanzhenjie.nohttp.rest.Response
import com.yoofn.framework.R
import com.yoofn.framework.config.ViewConfig
import com.yoofn.framework.databinding.ActivityReplaceBinding
import com.yoofn.framework.fragment.BaseFragment

/**
 *
 * Created by kalshen on 17/6/22.
 * @描述 &{TODO}
 */
class FragmentReplaceActivity : BaseActivity<ActivityReplaceBinding>() {

    companion object {

        val BUNDLE = "bundle"
        val FRAGMENT = "fragment"
    }
    override fun setupConfig(): ViewConfig {
        return ViewConfig(R.layout.activity_replace)
    }

    override fun initView() {
        val bundleExtra = intent.getBundleExtra(BUNDLE)
        val serializable = bundleExtra.getSerializable(FRAGMENT)
        val baseFragment = (serializable as Class<*>).newInstance() as BaseFragment<*>
        baseFragment.arguments = bundleExtra
        with(contentView) {
            supportFragmentManager.beginTransaction().replace(R.id.fl_replace_fragment, baseFragment).commit()
        }
    }

    override fun initClick() {

    }


    override fun doBusiness(what: Int, response: Response<String>) {

    }
}